class CreateRights < ActiveRecord::Migration
  def self.up
    create_table :rights do |t|
      t.string :controller_name   ,:limit => 20
      t.string :action_name       ,:limit => 20
      t.string :other_action_name ,:limit => 20  #处理某一action时,相关联的action,锁定子功能.
      t.string :right_type        ,:limit => 16  #普通权限,报表权限
      t.string :description       ,:limit => 30
      t.integer :is_locked        ,:limit => 1 ,:default => 0 #是否管理会要锁定 1为True 0为False
      t.timestamps
    end
    Right.create(:controller_name => 'orders',:action_name => 'outTicketList',:description=>'出票')
    Right.create(:controller_name => 'users',:action_name => 'userList',:description=>'员工管理')
    Right.create(:controller_name => 'customers',:action_name => 'customerList',:description=>'客户管理')
    Right.create(:controller_name => 'orders',:action_name => 'checkPerformance',:description=>'查看业绩')
    Right.create(:controller_name => 'orders',:action_name => 'outInsuranceList',:description=>'出保险')
    Right.create(:controller_name => 'orders',:action_name => 'printSendTicketList',:description=>'打印送票单')
    Right.create(:controller_name => 'orders',:action_name => 'cashCheckList',:description=>'订单收款')
    Right.create(:controller_name => 'orders',:action_name => 'checkOrderUpdateHis',:description=>'查看订单修改日志')
    Right.create(:controller_name => 'admin',:action_name => 'specialOffer',:description=>'特价信息发布')
    Right.create(:controller_name => 'admin',:action_name => 'zjlyPrice',:description=>'转机联运管理')
    Right.create(:controller_name => 'admin',:action_name => 'positionPrice',:description=>'舱位价格管理')
    Right.create(:controller_name => 'admin',:action_name => 'parameter_setup',:description=>'系统参数设置')
    Right.create(:controller_name => 'orders',:action_name => 'checkPoint',:description=>'积分维护')
    Right.create(:controller_name => 'admin',:action_name => 'policyManager',:description=>'政策管理')
    Right.create(:controller_name => 'orders',:action_name => 'expenditureList',:description=>'VIP统计')
    Right.create(:controller_name => 'orders',:action_name => 'clearQ',:description=>'Q结果查看')
    Right.create(:controller_name => 'reports',:action_name => 'reports',:description=>'业务报表')
    Right.create(:controller_name => 'orders',:action_name => 'searchOrderMain',:description=>'订单查找')
  end

  def self.down
    drop_table :rights
  end
end
